package presencial2011;
import java.util.Scanner;

public class Ventas {
	private static String dia(int i) {
		String sol = "";
		switch (i) {
		case 1:
			sol = "LUNES";
			break;
		case 2:
			sol = "MARTES";
			break;
		case 3:
			sol = "MIERCOLES";
			break;
		case 4:
			sol = "JUEVES";
			break;
		case 5:
			sol = "VIERNES";
			break;
		case 6:
			sol = "SABADO";
			break;
		case 7:
			sol = "DOMINGO";
			break;
		}
		return sol;
	}

	public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner in = new Scanner(System.in);

		double ventasDeHoy = in.nextDouble();
		while (ventasDeHoy != -1) {
			int i = 2; // Primer día el martes
			int maxDia = 2;
			int minDia = 2;

			double maxVentas = Double.MIN_VALUE;
			double minVentas = Double.MAX_VALUE;
			double mediaVentas = 0;
			double ventasDelDomingo = 0;

			while (i <= 7) {
				if (ventasDeHoy > maxVentas) {
					maxVentas = ventasDeHoy;
					maxDia = i;
				}
				if (ventasDeHoy < minVentas) {
					minVentas = ventasDeHoy;
					minDia = i;
				}
				mediaVentas += ventasDeHoy;
				ventasDelDomingo = ventasDeHoy;
				ventasDeHoy = in.nextDouble();
				i++;
			}

			mediaVentas /= 6;

			if (maxVentas == minVentas) {
				System.out.print("EMPATE");
			} else {
				System.out.print(dia(maxDia) + " " + dia(minDia));

				if (ventasDelDomingo > mediaVentas) {
					System.out.println(" SI");
				} else {
					System.out.println(" NO");
				}
			}
		}

	}
}
